package cn.springbak.publish.easytest;

import cn.springbak.publish.pojo.SysNotice;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.lang.annotation.Target;

@SpringBootTest
public class jsontest {

    @Test
    void testPojotoJson() throws Exception{
        SysNotice notice = new SysNotice();
        notice.setId(100L);
        notice.setTitle("Springdddd");
        ObjectMapper objectMapper
                = new ObjectMapper();
        String jsonStr =
                objectMapper.writeValueAsString(notice);
        System.out.println("json++++{}"+jsonStr);
        String[] ids = {"1","2","3"};
        String idStr = objectMapper.writeValueAsString(ids);
        System.out.println(ids);

        notice = objectMapper.readValue(jsonStr,SysNotice.class);
        System.out.println(notice);

    }
}
